﻿using System;
using System.Windows.Forms;
using ebc.message.contract;
using ebc.portal.contract;

namespace ebc.portal {
    public partial class GUI : Form , IPortal{
        public GUI() {
            InitializeComponent();
        }

        public event Action<CoordinatorRequest> OnCoordinator;

        private void RequestClick(object sender, EventArgs e) {
            var result = new CoordinatorResult();
            var coordinatorRequest = new CoordinatorRequest
            {
                FromSource = resultDisplay.Text + "=>OutputRequest Portal event OnCoordinator\t<=CoordinatorRequest=>" + Environment.NewLine,
                ShowResult = r => result = r
            };

            OnCoordinator( coordinatorRequest);
            resultDisplay.Text = string.Format("{0}=>InputResult Portal\t<=CoordinatorResult=>", result.FromTarget);
        }
    }
}
